import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import Chat from '../views/Chat.vue';

const routes = [
  { path: '/', component: Home },
  // Redirect /chat without ID to the home page or a specific chat (to be implemented)
  { 
    path: '/chat', 
    redirect: to => {
      // This would be replaced with logic to get the first chat or a default chat
      return { path: '/' };
    } 
  },
  // Chat with ID route
  { path: '/chat/:id', component: Chat, props: true },
];

export default createRouter({
  history: createWebHistory(),
  routes,
});
